// 管理后台布局样式
@use '../variables' as *;
.admin-layout {
    display: flex;
    min-height: 100vh;
    background-color: #f5f7fa;
}

.admin-sidebar {
    width: 250px;
    min-width: 250px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: $text-primary;
    transition: width 0.3s ease;
    border-right: 1px solid $border-light;
    box-shadow: $shadow-sm;
    flex-shrink: 0;
    &.collapsed {
        width: 64px;
        min-width: 64px;
        .nav-text {
            display: none;
        }
        .logo {
            display: none;
        }
    }
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid $border-light;
    .logo {
        margin: 0;
        font-size: 1.2rem;
        font-weight: $font-semibold;
        color: $text-primary;
    }
    .collapse-btn {
        background: none;
        border: none;
        color: $text-secondary;
        cursor: pointer;
        padding: 6px;
        border-radius: $radius-sm;
        transition: all $transition-normal;
        &:hover {
            background-color: rgba(99, 102, 241, 0.1);
            color: $primary-color;
        }
    }
}

.sidebar-nav {
    padding: 20px 0;
    .nav-item {
        display: flex;
        align-items: center;
        padding: 12px 20px;
        color: $text-secondary;
        text-decoration: none;
        transition: all $transition-normal;
        margin: 0 8px;
        border-radius: $radius-md;
        
        &:hover {
            background-color: rgba(99, 102, 241, 0.08);
            color: $primary-color;
            // 移除transform以避免滚动卡顿
            // transform: translateX(4px);
        }
        
        &.active {
            background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
            color: $primary-color;
            border-right: 3px solid $primary-color;
            font-weight: $font-medium;
            
            .el-icon {
                color: $primary-color;
            }
        }
        
        .el-icon {
            margin-right: 12px;
            font-size: 18px;
            color: $text-muted;
            transition: color $transition-normal;
        }
        
        .nav-text {
            font-weight: $font-medium;
        }
    }
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 64px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    .page-title {
        margin: 0;
        font-size: 1.5rem;
        font-weight: 600;
        color: $text-primary;
    }
    .user-info {
        display: flex;
        align-items: center;
        cursor: pointer;
        padding: 8px 12px;
        border-radius: 8px;
        transition: background-color 0.3s;
        &:hover {
            background-color: #f5f7fa;
        }
        .username {
            margin-left: 8px;
            font-weight: 500;
            color: $text-primary;
        }
    }
}

.admin-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; // 确保内容区域可以收缩
    min-width: 0;
    // 优化滚动性能
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    will-change: scroll-position;
}

// 响应式设计
@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        &.collapsed {
            transform: translateX(0);
        }
    }
    .admin-main {
        margin-left: 0;
    }
}

// 管理后台页面切换动画
.admin-page-enter-active {
    transition: opacity 0.3s ease-out;
  }
  
  .admin-page-enter-from {
    opacity: 0;
  }
  
  .admin-page-leave-active {
    transition: opacity 0.2s ease-in;
  }
  
  .admin-page-leave-to {
    opacity: 0;
  }
  
  .admin-page-component {
    width: 100%;
    height: 100%;
  }